//
//  SDAppConfigManager.m
//  SKinDiary
//
//  Created by pcyang on 16/7/24.
//  Copyright © 2016年 tencent. All rights reserved.
//

#import "SDAppConfigManager.h"

#define kBootTabSelectedIndex @"bootTabSelectedIndex"

static SDAppConfigManager* g_instance;

@interface SDAppConfigManager ()
@property(nonatomic,assign)int bootTabIndex;
@end


@implementation SDAppConfigManager
+(SDAppConfigManager*)sharedInstance
{
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        g_instance  = [[SDAppConfigManager alloc]  init];
        
        NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
        
        g_instance.bootTabIndex = [[userDefaults objectForKey:kBootTabSelectedIndex] intValue];
        
    });
    return g_instance;
    
}

-(id)init
{
    self = [super init];
    if (self) {
        
    }
    return  self;
}

-(void)setBootTabIndex:(int)tabIndex
{
    _bootTabIndex = tabIndex;
    NSUserDefaults *userDefaults = [NSUserDefaults standardUserDefaults];
    
    [userDefaults setObject:[NSNumber numberWithInt:tabIndex] forKey:kBootTabSelectedIndex];
    [userDefaults synchronize];

}

-(int)getBootTabSelectedIndex
{
    return  g_instance.bootTabIndex;
}
@end
